package be.xios.projectquiz.statuspanels;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JPanel;

/// <summary>
/// Deze klasse is een jpanel waaorp de status van de jury/master worden getekend
/// </summary>
/// <author>Sebastian Kubski</author>
@SuppressWarnings("serial")
public class JuryMasterStatusPanel extends JPanel {

	private boolean JuryConnected=false, JuryReady=false, MasterConnected=false, MasterReady=false;
	private Color matrixKleur;
	
	public JuryMasterStatusPanel(Color matrixKleur) {
		this.matrixKleur=matrixKleur;
	}
	
	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		this.setBackground(Color.BLACK);
		
		Graphics2D g2D=(Graphics2D) g;		
		g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);		

		g2D.setColor(matrixKleur);
		g2D.setFont(new Font("Arial", Font.BOLD, 12));
		
		g2D.drawRoundRect(2, 2, this.getWidth() - 5, this.getHeight() - 5, 5 , 5);
		
		g.drawString(( JuryConnected   ) ? "Jury connected"   : "Jury not connected"  ,   7, 30);
		g.drawString(( JuryReady       ) ? "Jury ready"       : "Jury not ready"      ,   7, 50);
		g.drawString(( MasterConnected ) ? "Master connected" : "Master not connected",   7, 70);
		g.drawString(( MasterReady     ) ? "Master ready"     : "Master not ready"    ,   7, 90);
	}

	//STATUS-setters
	public void setJuryConnected(boolean juryConnected) {
		JuryConnected = juryConnected;
	}

	public void setJuryReady(boolean juryReady) {
		JuryReady = juryReady;
	}

	public void setMasterConnected(boolean masterConnected) {
		MasterConnected = masterConnected;
	}

	public void setMasterReady(boolean masterReady) {
		MasterReady = masterReady;
	}
	//EINDE STATUS-setters
	
}